PACKAGE=psi
VERSION := $(shell rpm -q --qf '%{version}\n' --specfile $(PACKAGE).spec | head -1)
RELEASE := $(shell rpm -q --qf '%{release}\n' --specfile $(PACKAGE).spec | head -1)
ARCH := $(shell rpm -q --qf '%{arch}\n' --specfile $(PACKAGE).spec | head -1)
ARCHIVEVER := $(VERSION)

BINDIR      := /usr/bin/
RPM=$(HOME)/rpm

PRODUCT      = "PCLinuxOS 2007"
export PRODUCT


srccopy:
	cp $(PACKAGE)-$(VERSION).tar.gz /usr/src/rpm/SOURCES/

rpm: srccopy
	rpmbuild -ba $(PACKAGE).spec

rpm-install: rpm
	rpm -Uvh --force /usr/src/rpm/RPMS/$(ARCH)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(ARCH).rpm

upload:
	scp /usr/src/rpm/RPMS/$(ARCH)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(ARCH).rpm dsmid@oko.clever.cz:www/pclinuxos/2007/RPMS.czech
	scp /usr/src/rpm/SRPMS/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm dsmid@oko.clever.cz:www/pclinuxos/2007/SRPMS.czech
	ssh dsmid@oko.clever.cz www/pclinuxos/2007/regenerate
